package biz

import (
	"context"
	"github.com/go-kratos/kratos/v2/log"
	"gorm.io/gorm"
	"phm/models/generator/model"
)

type ScStudentRepo interface {
	CreateScStudent(ctx context.Context, uModel *model.ScStudent, db *gorm.DB) error
	UpdateScStudent(ctx context.Context, uModel *model.ScStudent, db *gorm.DB) error
	DeleteScStudentByIds(ctx context.Context, ids []string, db *gorm.DB) error
	GetScStudentById(ctx context.Context, id string) (*model.ScStudent, error)
	GetScStudentByIds(ctx context.Context, ids []string) ([]*model.ScStudent, error)
	GetScStudentList(ctx context.Context, query string, pageNum, pageSize int64) ([]*model.ScStudent, int64, error)
	// GetDB 得到db以方便事务处理
	GetDB() *gorm.DB
}

type ScStudentUseCase struct {
	scStudent ScStudentRepo
	log       *log.Helper
}

func NewScStudentUseCase(scStudent ScStudentRepo, logger log.Logger) *ScStudentUseCase {
	return &ScStudentUseCase{
		scStudent: scStudent,
		log:       log.NewHelper(logger),
	}
}
